package org.rcy.ruicingmarket.config;

import org.rcy.framework.mq.producer.KafkaMessageProducer;
import org.rcy.framework.mq.queue.KafkaDelayQueue;
import org.rcy.framework.mq.timer.SystemTimer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.KafkaTemplate;

/**
 * @author 吴康桥
 * @Description
 * @date 2022/11/24 9:43
 */

@Configuration
public class KafkaConfiguration {

	@Bean
	public SystemTimer systemTimer() {
		return new SystemTimer();
	}

	@Bean
	public KafkaDelayQueue kafkaDelayQueue(KafkaTemplate template,SystemTimer systemTimer) {
		return new KafkaDelayQueue(systemTimer, template);
	}

	@Bean
	public KafkaMessageProducer kafkaMessageProducer(KafkaTemplate template,KafkaDelayQueue kafkaDelayQueue) {
		return new KafkaMessageProducer(template, kafkaDelayQueue);
	}
}
